import request from '@/utils/request'

/**
 * 发布培训计划
 * @param {*} trainId 
 * @returns 
 */
export function publishTrain(trainId) {
  return request({
    url: '/drill/program/updateAndInsert/' + trainId,
    method: 'put'
  })
}

/**
 * 获取我的培训列表
 * @param {*} params 
 * @returns 
 */
export function getMyTrains(params) {
  return request({
    url: '/drill/program/selectDrillTrainProgramByUserId',
    method: 'get',
    params: params
  })
}

/**
 * 开始学习
 * @param {*} trainId 
 * @returns 
 */
export function startLearn(trainId) {
  return request({
    url: '/drill/program/startLearn/' + trainId,
    method: 'put'
  })
}

/**
 * 学习结束
 * @param {*} trainId 
 * @returns 
 */
export function endLearn(trainId) {
  return request({
    url: '/drill/program/endLearn/' + trainId,
    method: 'put'
  })
}

/**
 * 获取培训统计数据
 * @returns 
 */
export function programCount() {
  return request({
    url: '/drill/program/programCount',
    method: 'get'
  })
}

/**
 * 培训计划统计明细
 * @param {*} programId 
 * @returns 
 */
export function programInfo(programId) {
  return request({
    url: '/drill/program/programInfo/' + programId,
    method: 'get'
  })
}